﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microhard.Core.DBUtility;
using System.ComponentModel.DataAnnotations;
using Microhard.WST.BI.Buz.Validator;

namespace Microhard.WST.BI.Buz.Models
{
    [FluentValidation.Attributes.Validator(typeof(C6WorkflowConfigValidator))]
    public class JHFlowInfo : BasePermissionModel
    {
        [ModelPKID]
        public Guid OtherSysWFID { set; get; }
        public string WorkflowTypeCode { set; get; }
        private string _appID;
        private string _djsn;
        public string AppID
        {
            set
            {
                this._appID = value;
            }
            get
            {
                if (!string.IsNullOrEmpty(DJAPPIDForSelect))
                {
                    var apdj = DJAPPIDForSelect.Split(new char[] { '@' });
                    if (apdj.Count() == 2)
                    {
                        return apdj.First();
                    }
                }
                return _appID;
            }
        }
        public string DJSN
        {
            set
            {
                this._djsn = value;
            }
            get
            {
                if (!string.IsNullOrEmpty(DJAPPIDForSelect))
                {
                    var apdj = DJAPPIDForSelect.Split(new char[] { '@' });
                    if (apdj.Count() == 2)
                    {
                        return apdj.Last();
                    }
                }
                return _djsn;
            }
        }
        public string DefaultUserLoginCode { set; get; }
        public string UserCode { set; get; }
        public string Version { set; get; }
        [UIHint("SelectAppID")]
        public string DJAPPIDForSelect { set; get; }
    }
}
